import java.util.Arrays;
import java.util.Scanner;
//题目地址：https://www.lanqiao.cn/problems/3505/learning/
public class 买瓜 {
    //西瓜数量
    private static int n;
    //需要购买的西瓜重量
    private static int m;
    private static int[] wights;
    private static boolean[] isChoosed;
    private static int minDao = Integer.MAX_VALUE;
    private static int[] s;

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        m = scan.nextInt();
        wights = new int[n];
        isChoosed = new boolean[n];
        s = new int[n + 1];
        //记录每一个瓜的重量
        for (int i = 0; i < n; i++) {
            wights[i] = scan.nextInt();
        }

        // 将int数组转换为Integer数组
        Integer[] wightsInteger = Arrays.stream(wights).boxed().toArray(Integer[]::new);
        // 使用自定义Comparator进行降序排序
        Arrays.sort(wightsInteger, (a, b) -> b - a);
        // 将排序后的Integer数组转换回int数组
        wights = Arrays.stream(wightsInteger).mapToInt(Integer::intValue).toArray();
        //求后缀和
        for (int i = n - 1; i >= 0; i--) {
            s[i] = s[i + 1] + wights[i];
        }
        //开始dfs
        dfs(0, 0, 0);
        if (minDao == Integer.MAX_VALUE)
            minDao = -1;
        System.out.println(minDao);
    }

    private static void dfs(int currentNum, double currentWight, int currentDao) {
        //1.终止条件
        //1.1重量达标
        if (currentWight == m) {
            minDao = Math.min(currentDao, minDao);
            return;
        }
        //1.2 当前重量已经超过了m
        if (currentWight > m) return;
        //1.3当前重量加上后面的都不足m
        if (currentWight + s[currentNum] < m) return;
        //1.4当前刀数已经比最小值大了，也没必要往后了
        if (currentDao > minDao) return;
        //1.5 到达最底层了，还是满足不了条件
        if (currentNum > n - 1) return;
        //加一整个西瓜
        dfs(currentNum + 1, currentWight + wights[currentNum], currentDao);
        //加半个西瓜
        dfs(currentNum + 1, currentWight + wights[currentNum] / 2.0, currentDao + 1);
        //不加这个西瓜
        dfs(currentNum + 1, currentWight, currentDao);
    }
}